<%-- 
    Document   : registrarAdministrador
    Created on : 07-may-2014, 13:54:58
    Author     : Carlos Jose Mendoza
--%>

<%@page import="modelo.DAO.AdministradorDao"%>
<%@page import="modelo.Administrador"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%!
          Administrador admin = new Administrador();
          AdministradorDao administrador = new AdministradorDao();
        %>
        
        <%
            admin.setNombre(request.getParameter("nombre"));
             String vecChar[] = new String[12];
            String fech = request.getParameter("fechanacimiento");
            Character a = null;
            for(int i=0;i<fech.length();i++){
                a = fech.charAt(i);
                    vecChar[i] = a+"";
            }
            String fechaTotal =vecChar[8] + vecChar[9] + vecChar[4]  + vecChar[5] + vecChar[6] + vecChar[7] + vecChar[0] + vecChar[1] +vecChar[2] + vecChar[3];
            admin.setFechaNacimiento(fechaTotal);
            admin.setIdentificacionAdministrador(request.getParameter("id"));
            admin.setCorreo(request.getParameter("email"));
            admin.setPrimerApellido(request.getParameter("apellido1"));
            admin.setSegundoApellido(request.getParameter("apellido2"));
            admin.setBarrio(request.getParameter("barrio"));
            admin.setManzana(request.getParameter("manzana"));
            admin.setCalle(request.getParameter("calle"));
            admin.setTelefono(request.getParameter("telefono"));
            admin.setSexo(request.getParameter("sexo"));
            admin.setCiudad(request.getParameter("ciudad"));
            
            if(administrador.registrarAdmin(admin)){
                out.print("admin registrado");
            } else {
                 out.print("admin no registrado");
            }
            
        %>
    </body>
</html>
